import { createApp } from "vue";
import App from "./App.vue";
// reset style sheet
import "@/styles/reset.scss";
// CSS common style sheet
import "@/styles/common.scss";
// iconfont css
import "@/assets/iconfont/iconfont.scss";
// iconfonts css
import "@/assets/iconfonts/iconfont.css";
// fourAspect
import "@/assets/fouraspect/iconfont.css";
// import "@/assets/iconfonts/iconfont.js";
// font css
import "@/assets/fonts/font.scss";
// element css
import "element-plus/dist/index.css";
// element dark css
import "element-plus/theme-chalk/dark/css-vars.css";
// custom element dark css
import "@/styles/element-dark.scss";
// custom element css
import "@/styles/element.scss";
// svg icons
import "virtual:svg-icons-register";
// ant-design-vue
// import Antd from "ant-design-vue";
// import "ant-design-vue/dist/reset.css";
// element plus
import { ElLoading, ElMessageBox, ElMessage, ElInput } from "element-plus";
// import ElementPlus from "element-plus";
// 引入jquery
import jquery from "jquery";
Object.assign(window, { $: jquery, jquery });
// element icons
import * as Icons from "@element-plus/icons-vue";
// custom directives
import directives from "@/directives/index";
// vue Router
import router from "@/routers";
// vue i18n
import I18n from "@/languages/index";
// pinia store
import pinia from "@/stores";
// errorHandler
import errorHandler from "@/utils/errorHandler";
// 自行添加
// vxetable
import { SignalRPlugin } from "@/api/signalr";
// import { useVxe } from "./core/lazy_lib/vxe_use"; // 核心依赖库(按需引入)
import { lazyVxeUI, lazyVxeTable } from "./core/lazy_lib/vxe_use"; // 核心依赖库(按需引入)
import stable from "@/components/Stable/index.vue"; // 引入封装的vxetable表格
import SingalrModal from "@/components/SingalrModal/index.vue"; // 引入封装的SingalrModal
import SInput from "@/components/SInput.vue"; // 全局引入封装表格组件
import SSelect from "@/components/SSelect.vue";
import TreeSelect from "@/components/STree.vue"; // 全局引入封装TreeSelect组件
import http from "@/api"; //axios封装
import globalLoading, { globalState } from "@/components/globalLoading";
// 全局挂载modal
import Modal from "@/components/Modal/index.vue";
// 图片预览插件
import "viewerjs/dist/viewer.css";
import VueViewer from "v-viewer";
// 视频和音频预览插件
import VuePlyr from "vue-plyr";
import "vue-plyr/dist/vue-plyr.css";
// 引入jquery
import jQuery from "jquery";
Object.assign(window, { $: jQuery, jQuery });
// 移动端音频预览
import vue3videoPlay from "vue3-video-play"; // 引入组件
import "vue3-video-play/dist/style.css"; // 引入css
import ContextMenu from "@imengyu/vue3-context-menu";
import "@imengyu/vue3-context-menu/lib/vue3-context-menu.css";

const app = createApp(App);
import global from "@/utils/SnowflakeClass"; // 雪花算法
// app.config.errorHandler = errorHandler;

// register the element Icons component
for (const [key, component] of Object.entries(Icons)) {
  app.component(key, component);
}

app.provide("globalState", globalState);
app.config.globalProperties.$global = global;
app.config.globalProperties.$vueAxios = http; //全局注册http请求
app.component("Stable", stable);
app.component("SInput", SInput);
app.component("SSelect", SSelect);
app.component("TreeSelect", TreeSelect);
app.component("Modal", Modal);
app.component("SingalrModal", SingalrModal);
// useVxe(app);
globalLoading(app);
app
  // .use(ElementPlus)
  .use(lazyVxeUI)
  .use(lazyVxeTable)
  .use(ElLoading)
  .use(ElMessageBox)
  .use(ElMessage)
  .use(ElInput)
  .use(VueViewer, {
    defaultOptions: {
      zIndex: 9999
    }
  })
  .use(vue3videoPlay)
  .use(directives)
  .use(router)
  .use(I18n)
  .use(pinia)
  .use(VuePlyr, {
    plyr: {}
  })
  .use(ContextMenu)
  .use(SignalRPlugin)
  .mount("#app");
